/*
** monitor.h for  in /u/all/tessa_b/public/zappy/network/monitor
** 
** Made by arnaud1 tessa
** Login   <tessa_b@epitech.net>
** 
** Started on  Wed Jul  6 00:17:42 2011 arnaud1 tessa
** Last update Wed Jul  6 00:36:28 2011 arnaud1 tessa
*/

#ifndef			__MONITOR_H__
#define			__MONITOR_H__

#include		"socket.h"
#include		"sys/select.h"

typedef struct		s_monitor
{
  int			nb_observed_sockets;
  t_socket		**observed_sockets;
  t_server_socket	*acceptor;
  fd_set		read_fd_set;
  fd_set		write_fd_set;
  struct timeval	timeout;
  int			higher_fd;
}			t_monitor;
  

void			monitor_init(t_monitor *m);
void			monitor_monitor(t_monitor *m);
void			monitor_add_observed_socket(t_monitor *m, t_socket *sock);
void			monitor_remove_observed_socket(t_monitor *m, t_socket *sock);
void			monitor_set_observed_sockets(t_monitor *m);
int			monitor_is_set_for_reading(t_monitor *m, t_socket *sock);
int			monitor_is_set_for_writing(t_monitor *m, t_socket *sock);
int			monitor_is_set_for_accepting(t_monitor *m);

#endif		/*__MONITOR_H__*/
